<template>
  <div id="app">
    <span style="color: gold">wqtcccccc</span>
    <img alt="Vue logo" src="./assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js + TypeScript App" />
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import HelloWorld from "./components/HelloWorld.vue";
import request from "./utils/request";
import { AxiosError, AxiosResponse } from "axios";
import ApiResult from "./entitys/ApiResult";
import User from "@/entitys/User";
import ProMdeolFunds from "./entitys/ProModelFunds";
@Component({
  components: {
    HelloWorld
  }
})
export default class App extends Vue {
  private user!: User;
  private proModelFunds!: ProMdeolFunds;
  getUser(): void {
    request({
      url: "/sys/user/getUserDetail",
      params: {
        id: "2d14e9f88d924cbba7147dff743f5332"
      }
    })
      .then((response: AxiosResponse) => {
        const data: ApiResult<User> = response.data;
        if (data.status === 1) {
          this.user = data.data;
          console.log(this.user.updateDate);
        } else {
          this.user = {} as User;
          // console.log('1')
        }
      })
      .catch((error: AxiosError) => {
        console.log(error.message);
      });
  }
  getProModel(): void {
    request({
      url: "/promodel/proModel/getById",
      params: {
        id: "1473d1ccc997461180ff47e7314d55d8"
      }
    }).then(response => {
      const data: ApiResult<ProMdeolFunds> = response.data;
      if (data.status === 1) {
        this.proModelFunds = data.data;
      } else {
        this.proModelFunds = {} as ProMdeolFunds;
      }
    });
  }

  mounted(): void {
    this.getUser();
    this.getProModel();
  }
}
</script>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
</style>
